package xyz.chaobei.securitydeno.controller;

import org.springframework.web.bind.annotation.*;
import xyz.chaobei.securitydeno.model.OrgUser;

import java.util.LinkedList;
import java.util.List;


@RestController
@RequestMapping("/orgUser")
public class OrgUserController {

    private static final List<OrgUser> free = new LinkedList<>();


    @GetMapping("/{id}")
    public OrgUser getOne(@PathVariable("id") Integer id) {
        return free.stream().filter(item -> item.getId().equals(id)).findFirst().get();
    }

    @PostMapping("/")
    public Boolean save(@RequestBody OrgUser orgUser) {
        return free.add(orgUser);
    }


}
